{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a4a23cd2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7ed2d416",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 参数设置\n",
    "U = 1.0       # 来流速度\n",
    "a = 1.0       # 圆柱半径"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e2c385b7",
   "metadata": {},
   "source": [
    "理论推导部分：\n",
    "当圆柱绕流的环量 Γ 超过临界值 4πUa 时，驻点会脱离圆柱表面。\n",
    "流函数ψ表达式：\n",
    "ψ = U (r - a²/r) sinθ + (Γ/(4π)) ln r\n",
    "径向速度 u_r 和切向速度 u_θ：\n",
    "u_r = U (1 - a²/r²) cosθ\n",
    "u_θ = -U (1 + a²/r²) sinθ + Γ/(2πr)\n",
    "驻点条件：u_r = 0 和 u_θ = 0\n",
    "在圆柱表面 r = a 处，驻点条件变为：\n",
    "-U (1 + 1) sinθ_s + Γ/(2πa) = 0\n",
    "解得：sinθ_s = Γ/(4πUa)\n",
    "当 Γ = 4πUa 时，sinθ_s = 1，即 θ_s = π/2 或 3π/2。\n",
    "当 Γ > 4πUa 时，sinθ_s > 1，无解，说明驻点脱离圆柱表面。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ad0f0da",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算临界环量\n",
    "Gamma_critical = 4 * np.pi * U * a\n",
    "print(f\"临界环量 Γ_critical = {Gamma_critical:.2f}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e01271e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 工程修正：引入安全系数\n",
    "n_min = 1.5\n",
    "n_max = 2.0\n",
    "Gamma_safe_min = Gamma_critical / n_max\n",
    "Gamma_safe_max = Gamma_critical / n_min\n",
    "print(f\"安全环量范围 Γ_safe ∈ [{Gamma_safe_min:.2f}, {Gamma_safe_max:.2f}]\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "915db42b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 参数扫描范围\n",
    "Gamma_min = 0.0\n",
    "Gamma_max = 6 * np.pi * U * a\n",
    "print(f\"参数扫描范围 Γ ∈ [{Gamma_min:.2f}, {Gamma_max:.2f}]\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a2af134d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 输出安全环量范围\n",
    "print(\"\\n安全环量范围确定结果：\")\n",
    "print(f\"当 Γ > {Gamma_critical:.2f} 时，驻点脱离圆柱表面，流动可能分离。\")\n",
    "print(f\"建议的安全环量范围为 [{Gamma_safe_min:.2f}, {Gamma_safe_max:.2f}]，其中 n ∈ [1.5, 2.0]。\")"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
